package avicit.bdp.dms.tdm.dto;

import avicit.bdp.common.base.BaseDTO;
import avicit.platform6.core.annotation.log.FieldRemark;
import avicit.platform6.core.annotation.log.LogField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.apache.commons.lang3.StringUtils;

import javax.persistence.Column;
import javax.persistence.Table;
import javax.persistence.Transient;

@ApiModel(value = "BdpAssetMountModelDTO", description = "资产挂载模型")
@Table(name = "bdp_asset_mount_model")
public class BdpAssetMountModelDTO extends BaseDTO {
  private static final long serialVersionUID = 1L;

  /** 主键ID */
  @LogField
  @ApiModelProperty(value = "主键")
  @FieldRemark(column = "id", field = "id", name = "主键")
  @Column(name = "id")
  @avicit.platform6.core.annotation.log.Id
  @javax.persistence.Id
  private String id;

  /** 数据资产id */
  @LogField
  @ApiModelProperty(value = "数据资产id", name = "assetId")
  @FieldRemark(column = "asset_id", field = "assetId", name = "数据资产id")
  private String assetId;

  /** 资源类型[1-数据服务/2-文档/3-报表分析/4-模型] */
  @LogField
  @ApiModelProperty(value = "资源类型[1-数据服务/2-文档/3-报表分析/4-模型]", name = "assetType")
  @FieldRemark(column = "asset_type", field = "assetType", name = "资源类型[1-数据服务/2-文档/3-报表分析/4-模型]")
  private String assetType;

  /** 模型类型[1-逻辑模型/2-元数据/3-数据库表] */
  @LogField
  @ApiModelProperty(value = "模型类型[1-逻辑模型/2-元数据/3-数据库表]", name = "modelType")
  @FieldRemark(column = "model_type", field = "modelType", name = "模型类型[1-逻辑模型/2-元数据/3-数据库表]")
  private String modelType;

  /** 逻辑模型ID */
  @ApiModelProperty(value = "逻辑模型ID", name = "modelId")
  @FieldRemark(column = "model_id", field = "modelId", name = "逻辑模型ID")
  private String modelId;

  /** 数据源id */
  @ApiModelProperty(value = "数据源id", name = "datasourceId")
  @FieldRemark(column = "datasource_id", field = "datasourceId", name = "数据源id")
  private String datasourceId;

  /** 元数据ID */
  @ApiModelProperty(value = "元数据ID", name = "metadataId")
  @FieldRemark(column = "metadata_id", field = "metadataId", name = "元数据ID")
  private String metadataId;

  /** 数据表 */
  @ApiModelProperty(value = "数据表", name = "tableName")
  @FieldRemark(column = "table_name", field = "tableName", name = "数据表")
  private String tableName;

  /** 模型字段 */
  @ApiModelProperty(value = "模型字段", name = "columnInfo")
  @FieldRemark(column = "column_info", field = "columnInfo", name = "模型字段")
  private String columnInfo;

  /** 开放服务类型[1-数据查询/2-数据推送/3-API接口/4-下载/5-模型/6-报表] */
  @LogField
  @ApiModelProperty(
      value = "开放服务类型[1-数据查询/2-数据推送/3-API接口/4-下载/5-模型/6-报表]",
      name = "openServiceType")
  @FieldRemark(
      column = "open_service_type",
      field = "openServiceType",
      name = "开放服务类型[1-数据查询/2-数据推送/3-API接口/4-下载/5-模型/6-报表]")
  private String openServiceType;

  @Transient
  private String datasourceName;

  @Transient
  private String modelName;

  @Transient
  private String modelCnName;

  @Transient
  private String metadataName;

  public String getId() {
    return id;
  }

  public void setId(String id) {
    this.id = id;
  }

  public String getAssetId() {
    return assetId;
  }

  public void setAssetId(String assetId) {
    this.assetId = assetId;
  }

  public String getAssetType() {
    return assetType;
  }

  public void setAssetType(String assetType) {
    this.assetType = assetType;
  }

  public String getModelType() {
    return modelType;
  }

  public void setModelType(String modelType) {
    this.modelType = modelType;
  }

  public String getModelId() {
    return modelId;
  }

  public void setModelId(String modelId) {
    this.modelId = modelId;
  }

  public String getDatasourceId() {
    return datasourceId;
  }

  public void setDatasourceId(String datasourceId) {
    this.datasourceId = datasourceId;
  }

  public String getMetadataId() {
    return metadataId;
  }

  public void setMetadataId(String metadataId) {
    this.metadataId = metadataId;
  }

  public String getTableName() {
    return tableName;
  }

  public void setTableName(String tableName) {
    this.tableName = tableName;
  }

  public String getColumnInfo() {
    return columnInfo;
  }

  public void setColumnInfo(String columnInfo) {
    this.columnInfo = columnInfo;
  }

  public String getOpenServiceType() {
    return openServiceType;
  }

  public void setOpenServiceType(String openServiceType) {
    this.openServiceType = openServiceType;
  }

  public String getDatasourceName() {
    return datasourceName;
  }

  public void setDatasourceName(String datasourceName) {
    this.datasourceName = datasourceName;
  }

  public String getModelName() {
    return modelName;
  }

  public void setModelName(String modelName) {
    this.modelName = modelName;
  }

  public String getModelCnName() {
    return modelCnName;
  }

  public void setModelCnName(String modelCnName) {
    this.modelCnName = modelCnName;
  }

  public String getMetadataName() {
    return metadataName;
  }

  public void setMetadataName(String metadataName) {
    this.metadataName = metadataName;
  }

  public String getLogFormName() {
    if (StringUtils.isEmpty(super.logFormName)) {
      return "资产-模型";
    } else {
      return super.logFormName;
    }
  }

  public String getLogTitle() {
    if (StringUtils.isEmpty(super.logTitle)) {
      return "资产-模型";
    } else {
      return super.logTitle;
    }
  }
  
}
